<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>资产估值</title>
    <script src="../jQuery/jquery-1.11.2.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css"/>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/font.css">
    <style>::-webkit-scrollbar{display: none;}</style>
</head>
<body>
<blockquote class="layui-elem-quote news_search">
    <script type="text/html" id="secStock_search">
        <!--多条件查询层-->
        <div style="float: left;display: none">
            <form class="layui-form layui-col-md12 x-so">
                <!--估值日期：-->
                <div class="layui-input-inline">
                    <input type="date" name="date" id="date" placeholder="请输入估值日期" autocomplete="off" class="layui-input"/>
                </div>
                <button id="search" class="layui-btn  layui-btn-primary layui-bg-gray" lay-submit data-type="reload" lay-filter="provinceSearch">
                    <i class="layui-icon">&#xe615;</i>
                </button>
            </form>
        </div>
        <!--多条件查询结束-->

        <!--头部工具栏-->
        <div class="layui-btn-container layui-input-inline" style="margin-left: 1000px;">
            <button class="layui-btn layui-btn-normal" id="btn" lay-event="getCheckData" style="width: 100px;">估值</button>
        </div>
    </script>
    <table class="layui-hide" id="test" lay-filter="test"></table>


    <script>
        layui.use(['table','layer','form','laypage','util','jquery'],function () {
            //导入模块并得到模块对象
            var table = layui.table,//表格对象
                layer = layui.layer,//弹层对象
                form = layui.form,//表单对象
                laypage = layui.laypage,//分页组件
                $ = layui.jquery,//jquery对象
                util = layui.util;//工具对象
            var tables=table.render({
                elem: '#test'
                , url: '/assetValuation/asset'
                ,height:"740px"
                ,type:"get"
                , toolbar: '#secStock_search' //开启头部工具栏，并为其绑定左侧模板
                , defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                    title: '提示'
                    , layEvent: 'LAYTABLE_TIPS'
                    , icon: 'layui-icon-tips'
                }]
                , title: '用户数据表'
                ,limit:15
                , cols: [[ //表头
                    {field: 'assetId', title: '序号',fixed: 'left',align:"center",type:"numbers"},
                    {field:"dates",title:"估值日期",align:"center",templet :function(d) {
                            return util.toDateString(d.dates,"yyyy-MM-dd");/*'<span> '+dt.getFullYear()+'-'+(dt.getMonth()+1)+'-'+dt.getDate()+'</span>'*/
                        }},
                    {field:"seId",title:"证券编号",align:"center"},
                    {field:"seName",title:"证券名称",align:"center"},
                    {field:"valuation",title:"估值增值(元)",align:"center",templet:function (d) {
                            if (d.valuation.toString().indexOf(".")!=-1){
                                return d.valuation.toLocaleString();
                            }else{
                                return (d.valuation+ '').replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,')+".00";
                            }
                        }},
                    {field:"ifValuation",title:"是否估值",align:"center",templet:function (d) {
                            if (d.ifValuation=="未估值"){
                                return "<span style='color: red'>未估值</span>";
                            }else if (d.ifValuation=="已估值"){
                                return "<span style='color: #06b535'>已估值</span>";
                            }else{
                                d.ifValuation;
                            }
                        }}
                ]]
                , page: true

                ,limits: [5, 10,20,30,50]
            });

            //绑定表格头部事件
            table.on("toolbar(test)",function (obj) {
                switch(obj.event){
                    case "getCheckData":
                        $.ajax({
                            url:"/assetValuation/valuation",
                            type:"get",
                            data:"",
                            success:function (data) {
                                if (data=="success") layer.msg("统计成功",{icon:1});
                                else if (data=="already") layer.msg("当天已估值",{icon:2});
                                else layer.msg(data);
                                tables.reload("#test");
                            }
                        });
                        break;
                }
            })


        });
    </script>
</blockquote>
</body>
</html>